<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
// https://github.com/fzaninotto/Faker#fakerproviderinternet

$factory->define(App\Models\User::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->name,
        'description' => substr($faker->text,0,50),
        'avatar' => $faker->imageUrl(300,300),
        'loginid' => $faker->numberBetween(1550000000,1559999999).rand(0,9).'',
        'password' => bcrypt('123456'),
        'role_id'=>rand(1,3)
    ];
});


$factory->define(App\Models\SaleIntention::class, function (Faker\Generator $faker) {
    return [
        'custom_name' => $faker->company,
        'contact_name' => $faker->name,
        'contact_mobile' => $faker->phoneNumber,
        'intention' => substr($faker->text,0,20),
        'user_id' => 1
    ];
});


$factory->define(App\Models\Contact::class, function (Faker\Generator $faker) {
    return [
        'custom_id' => rand(1,3),
        'name'=>$faker->name,
        'gender'=>rand(0,1),
        'office_phone'=>$faker->phoneNumber,
        'mobile'=>$faker->phoneNumber,
        'title'=>$faker->jobTitle,
        'remark'=>substr($faker->text,0,20)
    ];
});

$factory->define(App\Models\Order::class, function (Faker\Generator $faker) {
    return [
        'order_id' => str_pad($faker->numberBetween(0,9999).'',4,'0',STR_PAD_LEFT),
        'order_date'=>$faker->date(),
        'status'=>rand(0,1),
        'address'=>$faker->streetAddress,
        'consignee'=>$faker->name,
        'mobile'=>$faker->phoneNumber,
        'remark'=>substr($faker->text,0,20),
        'total_amount'=>12.55
    ];
});
